<?php
/**
 * Created by PhpStorm.
 * User: Lenovo
 * Date: 2018/12/5
 * Time: 11:07
 */

namespace app\manage\model;


use think\Model;
use think\Session;

class Draw extends Model
{
    protected $autoWriteTimestamp = 'datetime';
    protected $updateTime= false;
    public static function getRoyaltys(){
        $Tid=Session::get('userid');
        $re=self::where('userid',$Tid)->select();
        return $re;
    }
    public static function addRoyalty($data){
        $re=self::create([
            'userid'=>Session::get('userid'),
            'power'=>1,
            'money'=>$data['money'],
            'account'=>$data['account'],
            'accounttype'=>$data['accounttype']
        ]);
        return $re;
    }
    public function getStatusAttr($value){
        $status=[0=>'审核中',1=>'已处理',2=>'驳回'];
        return $status[$value];
    }
    public function getAccounttypeAttr($value){
        $accounttype=[0=>'支付宝',1=>'微信'];
        return $accounttype[$value];
    }
}